package ar.edu.unicen.pladema.ui.model.g3d;

import java.util.Stack;

public class MatrixStack {
	protected Stack<Matrix> stack = new Stack<Matrix>();
	public MatrixStack() {
		Matrix start = new Matrix();
		start.setEscala(1);
		stack.push(start);
	}
	public Matrix getTransform() {
		Matrix result = null;
		for (Matrix matrix : stack) {
			if (result == null) {
				result = matrix;
			}else {
				result = result.multiply(matrix);
			}
		}
		return result;
	}
	public void push(Matrix transform) {
		stack.push(transform);
	}

}
